<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo ($title); ?></title>
    <meta name="keywords" content="<?php echo ($title); ?>">
    <meta name="description" content="<?php echo ($title); ?>">
    <link href="/Public/static/admin/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="/Public/static/admin/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="/Public/static/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/Public/static/admin/css/animate.min.css" rel="stylesheet">
    <link href="/Public/static/admin/css/style.min.css?v=4.1.0" rel="stylesheet">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>角色表</h5>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-sm-1">
                            <div class="input-group">
                                <a href="<?php echo U('add');?>" class="btn btn-outline btn-primary ">添加角色</a>
                            </div>
                        </div>
                    </div>
                    <div class="hr-line-dashed" style="margin: 10px"></div>
                    <div class="table-responsive">
                        <table class="table table-bordered">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>角色名称</th>
                                <th>拥有权限</th>
                                <th>状态</th>
                                <th>添加时间</th>
                                <th>更新时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody id="list_content">
                            <?php if(is_array($group_list)): $i = 0; $__LIST__ = $group_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><tr>
                                    <td><?php echo ($v["id"]); ?></td>
                                    <td><?php echo ($v["title"]); ?></td>
                                    <td><?php echo ($v["rules"]); ?></td>
                                    <td><a id="state<?php echo ($v["id"]); ?>" class="btn btn-<?php echo ($v['status']?'primary':'danger'); ?> btn-xs" href="javascript:;" onclick="changeState(<?php echo ($v["id"]); ?>)"><?php echo ($v['status']?'正 常':'禁 用'); ?></a></td>
                                    <td><?php echo (date("Y-m-d H:i",$v["add_time"])); ?></td>
                                    <td><?php echo (date("Y-m-d H:i",$v["up_time"])); ?></td>
                                    <td><a href="javascript:;" class="btn btn-primary btn-xs" onclick="changeRule(<?php echo ($v["id"]); ?>)"><i class="fa fa-paste"></i> 权限管理</a> &nbsp;&nbsp;<a href="javascript:;" class="btn btn-primary btn-xs" onclick="edit(<?php echo ($v["id"]); ?>)"><i class="fa fa-paste"></i> 编辑</a> &nbsp;&nbsp;<a href="javascript:;" class="btn btn-danger btn-xs" onclick="del(<?php echo ($v["id"]); ?>)"><i class="fa fa-trash-o"></i> 删除</a></td>
                                </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                            </tbody>
                        </table>
                        <?php echo ($page); ?>
                        <div id="listpage"></div>
                    </div>
                    <div class="spiner-example">
                        <div class="sk-spinner sk-spinner-three-bounce">
                            <div class="sk-bounce1"></div>
                            <div class="sk-bounce2"></div>
                            <div class="sk-bounce3"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>
<script src="/Public/static/admin/js/jquery.min.js"></script>
<script src="/Public/static/admin/js/bootstrap.min.js"></script>
<script src="/Public/static/admin/js/plugins/layer/layer.min.js"></script>
<script src="/Public/static/admin/js/plugins/laypage/laypage.js"></script>
<script src="/Public/static/admin/js/plugins/laytpl/laytpl.js"></script>
<script src="/Public/static/admin/js/common.js"></script>
<script>
    //修改
    function edit(id){
        location.href = '/admin/group/edit/id/'+id+'.html';
    }
    //修改权限
    function changeRule(id){
        location.href = '/admin/rule/group/id/'+id+'.html';
    }
    //删除
    function del(id){
        sxshop.del(id,"<?php echo U('del');?>","<?php echo U();?>")
    }
    //修改状态
    function changeState(id){
        var objectState = $('#state'+id);
        sxshop.state(id,"<?php echo U('changeState');?>",objectState);
    }
</script>
</body>
</html>